

import Book.BookList;
import User.AdminUser;
import User.NormalUser;
import User.User;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-01-02
 * Time: 20:25
 */
public class Test {
    public static User login(){
        System.out.println("请输入你的姓名:");
        Scanner scanner=new Scanner(System.in);
        String name=scanner.nextLine();
        System.out.println("请选择你的身份: 0:普通用户,1:管理员");
        int choice =scanner.nextInt();
        if(choice==1){
       return new AdminUser(name);
        }
        return new NormalUser(name);
    }
    public static void main(String[] args) {
        BookList bookList=new BookList();
        User user=login();
        while(true) {
            int choice = user.menu();
            user.doOperation(choice, bookList);
        }
    }
}
